package com.wise.entities.content;

import com.wise.framework.annotations.validation.AssertEnum;
import com.wise.framework.annotations.validation.NotBlank;
import com.wise.framework.annotations.validation.NotNull;
import com.wise.framework.daoannotations.Column;
import com.wise.framework.daoannotations.Table;
import com.wise.framework.entitiesbasic.IdTimeEntity;
import com.wise.model.content.enums.MenuExtContentType;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Tolerate;

import java.util.List;

import static com.wise.model.content.ContentErrMsgs.*;

@Setter
@Getter
@Table("content_menu")
public class Menu extends IdTimeEntity {

	/**
	 * 父类菜单id
	 */
	@Column("parentId")
	private String parentId;
	public static final String _parentId="parentId";

	/**
	 * 菜单图标
	 */
	@Column("icon")
	private String icon;

	/**
	 * 菜单路由
	 */
	@Column("url")
	private String url;

	/**
	 * 菜单名
	 */
	@Column("name")
	private String name;

	/**
	 * 排序
	 */
	@Column("seqencing")
	private Integer seqencing;

	/**
	 * 菜单是否启用状态
	 * 0：不启用   1：启用
	 */
	@Column("state")
	private Integer state;

	/**
	 * 菜单是否在底部显示
	 * 0:不显示   1：显示
	 */
	@Column("show_status")
	private Integer showStatus;

	/**
	 * 语言
	 */
	@Column("lang")
	private String lang;
	public static final String _lang = "lang";

	/**
	 * 菜单类型,默认0
	 */
	@Column("type")
	private Integer type;

	/**
	 * 产品类型
	 */
	@Column("ext_content")
	private String extContent;
	public static final String _extContent = "ext_content";

	/**
	 * 新品推荐
	 */
	@Column("new_recommend")
	private boolean newRecommend;

	@Column("alias")
	private String alias;

	@Column("title_pic")
	private String titlePic;
	public static final String _titlePic = "title_pic";

	@Column("description")
	private String description;
	public static final String _description = "description";

	@Column("title_pic_height")
	private String titlePicHeight;
	public static final String _titlePicHeight = "title_pic_height";

	private List<Menu> childList;

	@Getter
	@Setter
	public static class ExtContent {
		@NotNull(msg = Err_000500000023)
		@AssertEnum(enumClass = MenuExtContentType.class, msg = Err_000500000023)
		private Integer type;
		private List<ProductExtContent> info;
	}

	@Getter
	@Setter
	public static class ProductExtContent {
		@NotBlank(msg = Err_000500000024)
		private String id;
		@NotBlank(msg = Err_000500000025)
		private String categoryName;

		private String alias;

		private String path;

		private String filename;
	}
}
